//
//  BLHotelHomeTableViewCell.m
//  blanket
//
//  Created by Mac on 2018/11/14.
//  Copyright © 2018 stoneobs@icloud.com. All rights reserved.
//

#import "BLHotelHomeTableViewCell.h"

@interface  BLHotelHomeTableViewCell()
@property(nonatomic, strong) UIImageView                     *bannerImageView;/**<  */
@property(nonatomic, strong) STLabel                     *nameLable;/**<  */
@property(nonatomic, strong) STButton                    *addButton;/**<  */
@property(nonatomic, strong) STLabel                     *moneyLable;/**<  */
@end
@implementation BLHotelHomeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 90;
}
#pragma mark --subView
- (void)configSubView{
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
    imageView.image = [UIImage imageNamed:@""];
    [self addSubview:imageView];
    self.bannerImageView = imageView;
    
    ({
        STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 10, self.bannerImageView.top, UIScreenWidth - 20 - self.bannerImageView.right, 20)
                                                         text:@"希尔顿大酒店"
                                                    textColor:FirstTextColor
                                                         font:16
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentLeft];
        self.nameLable = titleLable;
        [self addSubview:titleLable];
    });
    self.addButton = [[STButton alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 10, 0, self.nameLable.width, 44)
                                               title:@"地址:四川成都"
                                                titleColor:SecendTextColor
                                                 titleFont:13
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"地址1"]];
    self.addButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    [self addSubview:self.addButton];
    self.addButton.centerY = self.bannerImageView.centerY;
    self.addButton.userInteractionEnabled = NO;
    
    ({
        STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.bannerImageView.right + 10, self.bannerImageView.top, UIScreenWidth - 20 - self.bannerImageView.right, 20)
                                                         text:@"400"
                                                    textColor:FlatRed
                                                         font:13
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentLeft];
        self.moneyLable = titleLable;
        [self addSubview:titleLable];
        self.moneyLable.bottom = self.bannerImageView.bottom - 0;
    });
}
- (void)setModel:(BLHotelListModel *)model{
    _model = model;
    [self.bannerImageView sd_setImageWithURL:[NSURL URLWithString:model.img]];
    self.nameLable.text = model.hotel_name;
    [self.addButton setTitle:model.address forState:UIControlStateNormal];
    self.moneyLable.text = [NSString stringWithFormat:@"￥%@  起",model.price];
    self.moneyLable.attributedText = [self.moneyLable.text st_convertAttributeStringWithKeyWord:@"起" attributes:@{NSForegroundColorAttributeName:FirstTextColor}];
}
@end
